package com.sdtv.mediunfusion.mvp.ui.outsidetask.constant;

import com.sdtv.mediunfusion.bean.StatusBean;

import java.util.ArrayList;
import java.util.List;

/**
 * @ProjectName: MediunFusion
 * @Package: com.sdtv.mediunfusion.mvp.ui.outsidetask.constant
 * @ClassName: TaskStatusConstant
 * @Description: 任务的状态列表
 * @Author: 小郭同学
 * @CreateDate: 2019-08-05 10:43
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class TaskStatusConstant {

    //状态列表
    private List<StatusBean> statusBeanList = new ArrayList<>();

    /**
     * 设置状态栏的内容
     */
    public List<StatusBean> getStatusListData() {

        statusBeanList = new ArrayList<>();

        StatusBean item_0 = new StatusBean();
        item_0.setName("全部状态");
        item_0.setSelected(false);
        item_0.setType("");
        statusBeanList.add(item_0);
        // 0：进行中；1：已完成；2：撤销中；3：已撤销 4：待领取
        StatusBean item_5 = new StatusBean();
        item_5.setName("待领取");
        item_5.setSelected(false);
        item_5.setType("4");
        statusBeanList.add(item_5);

        StatusBean item_1 = new StatusBean();
        item_1.setName("进行中");
        item_1.setSelected(true);
        item_1.setType("0");
        statusBeanList.add(item_1);

        StatusBean item_2 = new StatusBean();
        item_2.setName("已完成");
        item_2.setSelected(false);
        item_2.setType("1");
        statusBeanList.add(item_2);

        StatusBean item_4 = new StatusBean();
        item_4.setName("撤销中");
        item_4.setSelected(false);
        item_4.setType("2");
        statusBeanList.add(item_4);

        StatusBean item_3 = new StatusBean();
        item_3.setName("已撤销");
        item_3.setSelected(false);
        item_3.setType("3");
        statusBeanList.add(item_3);

        return statusBeanList;
    }

    //改变statusBeanList的选中状态

    public List<StatusBean> changeSelectItem(StatusBean statusBean) {
        if (!statusBeanList.isEmpty()) {
            for (int i = 0; i < statusBeanList.size(); i++) {
                StatusBean tempBean = statusBeanList.get(i);
                if (tempBean.getName().equals(statusBean.getName())) {
                    tempBean.setSelected(true);
                } else {
                    tempBean.setSelected(false);
                }
            }
        }
        return statusBeanList;
    }
}
